Skip to content

fix: Reuse the first page in autoPagination - #1748

Merged
gjtorikian merged 1 commit into
mainfrom
fix/auto-pagination-first-page
Nov 3, 2026
Merged

gjtorikian merged 1 commit into
mainfrom
fix/auto-pagination-first-page

Conversation

@gjtorikian

Copy link
Copy Markdown
Contributor

Description

Fixes #1746.

AutoPaginatable.autoPagination() ignored the page the list method had already fetched and re-requested the list from the start with limit=100. Every list…().autoPagination() call therefore cost at least two sequential round trips, even when the first response already held the whole list. This has been the incorrect behavior since auto-pagination was added in #788.

  • autoPagination() now returns the first page as-is when it has no after cursor, and otherwise continues from that cursor. A single-page list goes from 2 requests to 1; multi-page lists never make more requests than before.
  • generatePages takes just the after cursor. Follow-up pages always walk forward from the first page, so the before special case from fix: drop before cursor on follow-up autoPagination requests #1720 is no longer needed (before is still stripped from follow-up requests).
  • Updated the pagination.spec.ts, pipes-requests.spec.ts, and feature-flags.spec.ts cases that asserted the redundant re-fetch, and added a case for the no-next-page path.

Every list method already makes the first request before handing the
result to AutoPaginatable, but autoPagination() ignored that page and
requested the list from the start again with limit=100. Every
autoPagination() call therefore cost at least two round trips, even
when the first response already held the whole list.

Continuing from the first page's cursor drops the redundant request.
Follow-up pages still walk forward from that page, which also makes
the before-cursor special case from #1720 unnecessary.

Fixes #1746
@gjtorikian
gjtorikian requested review from a team as code owners November 2, 2026 23:11
@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

autoPagination() now reuses the page already fetched by the list method.

  • Auto-pagination keeps the first page and follows only its next-page cursor.

No actionable issues were found. Tests were reviewed but not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["autoPagination()"] --> B{"Limit set or no after cursor?"}
  B -->|Yes| C["Return first-page data"]
  B -->|No| D["Copy first-page data"]
  D --> E["Fetch next page using after; drop before"]
  E --> F["Append page data"]
  F --> G{"Another after cursor?"}
  G -->|Yes| H["Wait 350 ms"]
  H --> E
  G -->|No| I["Return combined data"]
Loading

Reviews (1) · Last reviewed commit: "fix: Reuse the first page in autoPaginat..." · Reviewed by Greptile

@gjtorikian
gjtorikian merged commit 51b6f0b into main Nov 3, 2026
9 checks passed
@gjtorikian
gjtorikian deleted the fix/auto-pagination-first-page branch November 3, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

autoPagination() discards the first response and requests the list again

2 participants